﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace lchealthy
{
    public partial class frmbuylist : Form
    {
        int cid = 0;
        public frmbuylist(int id)
        {
            cid = id;
            InitializeComponent();
        }

        private void frmbuylist_Load(object sender, EventArgs e)
        {
            string sql = "SELECT ProductInfo.PName, RecordsInfo.RAmount, RecordsInfo.RDate FROM ProductInfo RIGHT JOIN RecordsInfo ON ProductInfo.PID = RecordsInfo.PID where cid= " + cid + " order by RDate desc ";
            DataSet ds = DbHelperOleDb.Query(sql);
            dgvbuylist.DataSource = ds.Tables[0];

        }

        private void btnOUT_Click(object sender, EventArgs e)
        {
            myfun.DataToExcel(dgvbuylist);
        }

        private void btnprint_Click(object sender, EventArgs e)
        {
            myprint m = new myprint(dgvbuylist);
            m.Print();
        }
    }
}
